<?php session_start(); ?>
<?php include "libfunc.php";?>
<?php if (!empty($_SESSION['admUser']) && !empty($_SESSION['admPass'])) { ?>
<html>
 <head>
  <title>.: Admin Room ClothingCorp :.</title>
  <link href="admInc/cssMainStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssTableStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssAdditionStyle.css" type="text/css" rel="stylesheet">
  <link href="admInc/cssTableNavigation.css" type="text/css" rel="stylesheet">
 </head>
 <body class="fix">
  <div id="wrapper">
   <div id="header">
    <div class="titleHeader"><center>
     <img src="image/logo2.png" border="0">
	</div><!-- titleHeader //-->
	<div class="subTitleHeader"><center>
	 - Website Administrator Control Panel -
	</div><!-- subTitleHeader //-->
   </div><!-- header //--></center>
   <div id="mainContent">
    <div id="leftColumn">
	 <div class="navigation">
	  <table border="0" width="100%" bgcolor="white">
	  <tr>
	    <td class="headerTable" align="center"><b>Admin Page</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="adminLayout.php"> Halaman Utama</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="newInformation.php"> Informasi Terkini</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="LogOut.php" onClick="return confirm('Apakah Anda benar-benar akan keluar dari halaman Admin ?')"> Keluar</a></td>
	  </tr>
	  <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Kategori</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_kategori.php"> Tambah Kategori</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_kategori.php"> View Kategori</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_kategori.php"> Pencarian Kategori</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Member</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_member.php"> Tambah Member</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_member.php"> View Member</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_member.php"> Pencarian Member</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Produk</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_produk.php"> View Produk</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_produk.php"> Pencarian Produk</a></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Penjual</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="tambah_pejual.php"> Tambah Penjual</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_penjual.php"> View Penjual</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_penjual.php"> Pencarian Penjual</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  <tr>
		<td></td>
	  </tr>
	  <tr>
	    <td class="headerTable" align="center"><b>Data Pesanan</b></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="view_pesanan.php"> View Pesanan</a></td>
	  </tr>
	  <tr>
	    <td><img src="image/tag_blue.png"><a href="pencarian_pesanan.php"> Pencarian Pesanan</a></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
      <tr>
	    <td></td>
	  </tr>
	  
	</table>
	 </div><!-- navigation //-->
	</div><!-- leftColumn //-->
	<div id="rightColumn">
	 <div class="content">
	<?php
		error_reporting(0);
		$id_produk 	 = $_POST['id_produk'];
		$id_penjual  = $_POST['id_penjual'];
		$id_kategori = $_POST['id_kategori'];
		$id = $_GET['id']; // ambil id
		  
	  //-------- koneksi ke database
	  $link = koneksi_db();
	  $sql  = "select * from produk where id_produk = '$id'";
	  $res  = mysql_query($sql,$link);
	  $data = mysql_fetch_array($res);
	  
	  $sql_p  = "select * from penjual where id_penjual = '$id_penjual[id_penjual]'";
	  $res_p  = mysql_query($sql_p,$link);
	  $data_p = mysql_fetch_array($res_p);
	  
	  $sql_k  = "select * from kategori where id_kategori = '$id_kategori[id_kategori]'";
	  $res_k  = mysql_query($sql_k,$link);
	  $data_k = mysql_fetch_array($res_k);
	  
	  //--------- end of koneksi database
    ?>   
      <!-- View Data produk //-->
      <fieldset>
       <legend>Data produk :: <?php echo $data['judul']; ?></legend>
        <table align="center" class="tableDetail">
         <tr>
          <td><u>Gambar</u></td>
         </tr>
         <tr>
          <td>
          <?php 
		    error_reporting(0);
		    if($data['filegambar']==""){
			  	echo "<b>Tidak Ada Gambar</b>";
		    }else{
		  ?>
				<img src="gambar_produk/<?php echo $data['filegambar']; ?>">
          <?php
			}
		  ?>
          </td>
         </tr>
         <tr>
          <td></td>
         </tr>
         <tr>
          <td><u>Deskripsi produk</u></td>
         </tr>
         <tr>
           <td><b><?php echo $data['deskripsi']; ?></b></td>
         </tr>
        </table>
        <br>
        <table align="center" class="tableDetail">
		 <tr>
		  <td width="129"><u>ID produk</u></td>
          <td width="21" align="right">:</td>
          <td width="434"><strong><?php echo $data['id_produk']; ?></strong></td>
         </tr>
         <tr>
		  <td><u>Nama Kategori</u></td>
          <td align="right">:</td>
          <td><strong><?php echo $data_k['nama']; ?></strong></td>
         </tr>
         <tr> 
          <td><u>Nama Penjual</u></td>
          <td align="right">:</td>
          <td><strong><?php echo $data_p['nama']; ?></strong></td>
         </tr>
          <tr>
		  <td><u>Harga</u></td>
          <td align="right">:</td>
          <td><strong><?php echo $data['harga']; ?></strong></td>
         </tr>
         <tr>
		  <td><u>Stok</u></td>
          <td align="right">:</td>
          <td><strong><?php echo $data['stok']; ?></strong></td>
         </tr>
         <tr>
		  <td><u>Diskon</u></td>
          <td align="right">:</td>
          <td><strong><?php echo $data['diskon']; ?></strong></td>
         </tr>
         <tr>
		  <td><u>Status Dijual</u></td>
          <td align="right">:</td>
          <td>
		    <strong><?php 
			  if ( $data['dijual'] == "Y" ) {
				echo "Ya";
			  }else{
				echo "Tidak";  
			  }
			?></strong>
          </td>
         </tr>
         <tr>
		  <td><u>Status Dihapus</u></td>
          <td align="right">:</td>
          <td>
            <strong><?php 
			  if ( $data['dihapus'] == "Y" ) {
				echo "Ya";
			  }else{
				echo "Tidak";  
			  }
			?></strong>
          </td>
         </tr>
		 <tr>
		  <td><u>AKSI</u></td>
          <td align="right">:</td>
          <td>
		   <a href="form_edit_produk.php?id=<?php echo $data['id_produk']; ?>"><img src="image/page_edit.png" title="Edit" border="0"></a>
		  </td>
		 </tr>
		</table>
	  </fieldset>
      <!-- View Data produk//-->
      
      <!-- keterangan //-->
	  <div id="keterangan">
       <fieldset>
        <legend>Keterangan</legend>
         Menu View Data produk <b><?php echo $data['judul']; ?></b>. Anda dapat mengedit data tersebut !!!
       </fieldset>
       </div><!-- keterangan //-->
	 </div><!-- content //-->
	</div><!-- rightColumn //-->
   </div><!-- mainContent //-->
  </div><!-- wrapper //-->
 </body>
</html>
<?php
}else{
  echo "<script language='javascript'>alert('Silakan Sign In Terlebih Dahulu')</script>";
  echo "<script language='javascript'>window.location = '../admin/'</script>";
}